package com.md2ppt.config;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/**
 * 演示文稿配置数据模型
 * 对应JSON配置文件结构
 */
public record PresentationConfig(
    @JsonProperty("metadata") PresentationMetadata metadata,
    @JsonProperty("settings") PresentationSettings settings,
    @JsonProperty("slides") List<SlideConfig> slides
) {
    
    public static record PresentationMetadata(
        @JsonProperty("title") String title,
        @JsonProperty("author") String author,
        @JsonProperty("version") String version,
        @JsonProperty("created") String created
    ) {}
    
    public static record PresentationSettings(
        @JsonProperty("theme") String theme,
        @JsonProperty("quality") String quality,
        @JsonProperty("timeout_seconds") Integer timeoutSeconds,
        @JsonProperty("animation_engine") String animationEngine,
        @JsonProperty("fallback_engine") String fallbackEngine
    ) {
        // Mutable setters for command line overrides
        public void setQuality(String quality) {
            // Create new record with updated quality
        }
        
        public void setTimeoutSeconds(int timeoutSeconds) {
            // Create new record with updated timeout
        }
    }
    
    public static record SlideConfig(
        @JsonProperty("index") int index,
        @JsonProperty("title") String title,
        @JsonProperty("content") List<ContentElement> content,
        @JsonProperty("animations") List<AnimationConfig> animations,
        @JsonProperty("layout") SlideLayout layout
    ) {}
    
    public static record ContentElement(
        @JsonProperty("type") String type,
        @JsonProperty("data") Map<String, Object> data,
        @JsonProperty("position") Position position,
        @JsonProperty("style") Map<String, Object> style
    ) {}
    
    public static record AnimationConfig(
        @JsonProperty("target_element") String targetElement,
        @JsonProperty("effect_type") String effectType,
        @JsonProperty("timing") AnimationTiming timing,
        @JsonProperty("properties") Map<String, Object> properties
    ) {}
    
    public static record AnimationTiming(
        @JsonProperty("start_delay") double startDelay,
        @JsonProperty("duration") double duration,
        @JsonProperty("repeat_count") int repeatCount,
        @JsonProperty("auto_reverse") boolean autoReverse
    ) {}
    
    public static record SlideLayout(
        @JsonProperty("template") String template,
        @JsonProperty("background") Map<String, Object> background,
        @JsonProperty("dimensions") Dimensions dimensions
    ) {}
    
    public static record Position(
        @JsonProperty("x") double x,
        @JsonProperty("y") double y,
        @JsonProperty("width") double width,
        @JsonProperty("height") double height
    ) {}
    
    public static record Dimensions(
        @JsonProperty("width") int width,
        @JsonProperty("height") int height
    ) {}
}